Skip to content

Read canonical test worker replies through portable pipes - #9218

Open
loopx-agent wants to merge 3 commits into
mainfrom
codex/canonical-fixture-windows-pipe-20261121
Open

loopx-agent wants to merge 3 commits into
mainfrom
codex/canonical-fixture-windows-pipe-20261121

Conversation

@loopx-agent

@loopx-agent loopx-agent commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Goal and scope

The Windows research fixture tests fail before they can read the saved results. Python's Windows selector rejects the canonical test worker's anonymous stdout pipe with WinError 10038. Both #9204 and #9200 reproduced that failure in four research fixtures.

The worker reads complete UTF-8 response lines through a thread and a queue owned by the child process. It retains the response deadline and recovery for an exited child. Child shutdown and the output readers share one cleanup deadline. Each reader closes its stream when the pipe is released, so a descendant holding the old pipes cannot block the timeout or a later request to a replacement worker.

Validation

Tested commit 843e531cf7ef9791c122f398b83c60c3876eae80 against main at b4e1ded.

  • A new real subprocess regression makes the direct Node worker exit while a descendant holds both output pipes. On 7b9ccbe, the caller remained blocked in cleanup after the request deadline. The current commit delivers the timeout and accepts a request through a new worker while both old pipes are still held. Releasing the descendant closes both old streams.
  • Eighteen macOS tests passed with PYTHONUTF8=0. They include saved research results over HTTP, real File and SQLite setup, worker respawn, and both timeout cases.
  • The macOS socket-only selector probe passed large split UTF-8 replies, subsequent requests, partial response rejection, and silent-child reaping. Under the same restriction, the combination with Recover Steward steering receipts after Chat restart #9200 passed 21 tests, and the seven focused research fixtures passed with Keep native Inbox delegation reads complete across host budgets #9204.
  • Ruff and standard premerge passed. The new head awaits independent review and the hosted Windows run.

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

动机 / Motivation

维护者运行真实 File/SQLite fixture 的 CLI 和 Research 回归,需要在所有支持的宿主读取可复验的结果。 共享 fixture 在匿名管道上使用 selectors。其 TimeoutError 原先进入更宽的 OSError 分支。 Research 测试通过有状态的 Node fixture 写入并读回 canonical authority。Windows 选择器拒绝进程的匿名管道,因此旧版在读回前退出。现在成功路径按完整 UTF-8 行收件,静默超时留给调用者一次明确失败。 每个子进程拥有独立的逐行回复队列和 stderr 读端。定时等待以已收到的完整行或明确失败结束。 仅涉及测试基础设施,本次独立证据为 macOS 真实 Node 管道与 socket-only 模拟。原生 Windows 资格仍独立。

改动思路 / Approach

在既有 worker 的 spawn 中装配两个单进程 reader,复用现有请求锁和一次重生规则。 超时只清理该 fixture 自己的进程。正常 EOF 可以按原调用契约重生一次,生产运行时无调用新增。 在已有可复用 fixture 修复,使所有消费者共享同一个协议和清理所有者。缺少独立 worker 的新 smoke 不会覆盖这条实际调用链。

具体改动 / Changes

准确头 7b9ccbe,merge base a6ffb3b,2 个文件,+70/-44。当前主干 b4e1ded 整合预演无冲突。逐行读取、重生与清理均在共享 worker 内。回归只增加一个真正静默的 Node 对端。 按修订 a6ffb3b 的现有规范核对各项要求。 目标规范

  • process-boundary · Use the actual child pipe at the existing fixture call site.
  • single-timeout · Propagate timeout once and reap the same child and readers.
  • durable-regression · Keep a real non-duplicative fixture test protecting an existing consumer boundary.

关键代码讲解

对主干的风险 / Risks

在 macOS 设置 PYTHONUTF8=0,canonical fixture 与 Research 消费者测试独立跑完,83 项通过,4 项跳过。另用实际 Node 匿名管道,在一个进程里连续读回三条大响应,写端刻意在 UTF-8 字符中间切块。完整文本与每次请求序号一致,另让子进程收到请求后写出半行并退出,主干和当前头都只起一个新子进程,随后返回完整新回复。 以同一个只接受 socket 的 selector 替身运行旧主干和准确头。旧版注册匿名管道失败。旧版静默子进程还会错误重发,再把 TimeoutError 改成 AssertionError。当前头实测静默脚本仅收到一条请求,返回 TimeoutError,原进程退出,两条 reader 线程均结束。 精确源码 quick premerge 5 项直接检查和 3 项 catalog 都执行通过。前后对照覆盖 socket-only 和静默超时,实际本地 Research fixture 同时覆盖正常入口。 Windows 原生匿名管道行为仍需在对应宿主确认。本轮不把 socket-only 仿真当成 Windows 执行结果。

我的整体评价 / Verdict

批准。在既有 worker 的 spawn 中装配两个单进程 reader,复用现有请求锁和一次重生规则。 超时只清理该 fixture 自己的进程。正常 EOF 可以按原调用契约重生一次,生产运行时无调用新增。 批准准确头。共享改动解除 fixture 的 socket-only 依赖,收紧静默请求的重放边界,保留退出后重生和实际 File/SQLite 消费者路径。生产入口未引入新 worker。

English verdict: APPROVE at 7b9ccbe. Approve the exact head for the test-only transport repair. Real local pipes preserved split UTF-8 replies and a silent child was reaped after one request. Native Windows qualification is still separate.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant